#include <fstream>
#include <iostream>

int main(int argc, char **argv)
{
    if (argc != 2)
    {
        std::cerr << "Usage: " << argv[0] << " filename\n";
        return 0;
    }
    else
    {
        std::ifstream ifs(argv[1]);
        if (!ifs)
        {
            std::cerr << "can't open input file " << argv[0] << std::endl;
            return 1;
        }
        int n, sum = 0;
        while (ifs >> n)
        {
            sum += n;
        }
        std::cout << sum << std::endl;
    }
}